﻿namespace HuwmanCode

open System

[<AutoOpen>]
module BooleanExtension =
    type System.Boolean with
        /// <summary>
        /// Converts a boolean value to a 't option.
        /// </summary>
        member x.ToOption(value) =
            Option.create(x, value)

        /// <summary>
        /// Converts a boolean value to a 't option.
        /// </summary>
        member x.ToOption(value:'t option) =
            Option.create(x, value) |> Option.peel